/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.ingsoc2;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

/**
 *
 * @author sebastian
 */
public class ModelDBHSQL implements ModelDB {

    public ModelDBHSQL() {
    }

    public boolean createModel(Connection conn) throws SQLException 
    {       
            try{
        Statement stmt = conn.createStatement();
        stmt.executeUpdate("CREATE TABLE genero(id int IDENTITY, nombre varchar(100));");
        stmt.executeUpdate("CREATE TABLE pelicula("
                + "id int IDENTITY, "
                + "titulo varchar(100),"
                + "descripcion varchar(100),"
                + "actor_principal varchar(100),"
                + "duracion int,"
                + "director varchar(100),"
                + "id_genero int);");
        stmt.executeUpdate("insert into genero VALUES(1, 'Terror');");
        stmt.executeUpdate("insert into genero VALUES(2, 'Comedia');");
        stmt.executeUpdate("insert into genero VALUES(3, 'Suspenso');");
        stmt.executeUpdate("insert into genero VALUES(4, 'Drama');");
        stmt.executeUpdate("insert into genero VALUES(5, 'Accion');");
    }catch(Exception e){
}
        return true;
    }

}
